<template>
    <div class="material-content">
        <div class="content-box">
            <div class="material-title" style="color: rgb(255, 105, 0)">
                <span class="text-material">{{ props.fodderContent.name || "--" }}</span>
                <a-tooltip :title="props.fodderContent.prompt">
                    <HeartOutlined v-if="props.fodderContent.clean" />
                    <HeartFilled v-else />
                </a-tooltip>
            </div>

            <div class="material-tag">
                <span>'--'</span>
                <div>标签设置</div>
            </div>

            <div class="title-text">内容</div>

            <div class="details-all">
                <Details :details="props.fodderContent.content" quantity="all" />
            </div>
        </div>
        <div class="function-box">
            <a-tooltip v-for="it in props.fodderContent.functionList" :title="it.name">
                <div @click="clickFunction(props.fodderContent, it)">
                    <RetweetOutlined v-if="it.genre === 'send'" />
                    <FormOutlined v-if="it.genre === 'edit'" />
                    <CopyOutlined v-if="it.genre === 'copy'" />
                    <LoginOutlined v-if="it.genre === 'merge'" />
                    <DeleteOutlined v-if="it.genre === 'danger'" />
                </div>
            </a-tooltip>
        </div>
    </div>
</template>

<script setup lang="ts">
import {ref} from "vue";
import {
    RetweetOutlined,
    FormOutlined,
    CopyOutlined,
    LoginOutlined,
    DeleteOutlined,
    HeartOutlined,
    HeartFilled,
    CheckCircleFilled,
} from "@ant-design/icons-vue";
import Details from "@/components/Document/Details.vue";
const props = defineProps<{
    fodderContent: {
        name: string;
        time: string;
        clean: boolean;
        batchSelect: boolean;
        prompt: string;
        label: string;
        amount: number;
        id: number;
        type: string;
        content: {
            img: string;
            type: string;
            title: string;
            subheading: string;
        }[];
        functionList: {
            name: string;
            genre: string;
        }[];
    };
}>();

//点击清除
const emit = defineEmits(["collect", "clickFunction", "clickMaterial"]); // 声明 'collect' 事件
//点击编辑，群发等
const clickFunction = (res, it) => {
    emit("clickFunction", {res, it});
};
// 确保传入的props中包含上述所有字段
</script>

<style scoped lang="less">
.material-content {
    width: 288px;
    background: #f5f5f5;
    position: relative;
    background-color: #f9f9f9;
    flex-shrink: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .content-box {
        flex-grow: 1;
        overflow: auto;
        .material-title {
            display: flex;
            align-items: center;
            margin-bottom: 12px;
            font-weight: 700;
            font-size: 14px;
            gap: 10px;
            .text-material {
                overflow: hidden;
                white-space: nowrap;
                word-break: break-all;
                text-overflow: ellipsis;
                color: #222333;
            }
        }
        .material-tag {
            background-color: #fff;
            padding: 8px;
            border-radius: 4px;
            border: 1px solid #f0f0f0;
            margin-bottom: 20px;
            div {
                margin-top: 8px;
                font-size: 12px;
                cursor: pointer;
                color: #3070ff;
                cursor: pointer;
            }
            span {
                color: #888999;
                font-size: 12px;
                margin-top: 8px;
                display: block;
            }
        }
        .title-text {
            color: rgba(0, 0, 0, 0.25);
            font-size: 12px;
        }
        .details-all {
            position: relative;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
    }
    .function-box {
        width: 100%;
        height: 48px;
        background-color: #f9f9f9;
        color: rgba(0, 0, 0, 0.85);
        display: flex;
        justify-content: space-around;
        align-items: center;
        border-top: 1px solid #e9e9e9;
    }
}
</style>
